<style lang="less">
  @import '../styles/common.less';
</style>
<style>
  .show-accessory .a {
    margin-left: 10px;
  }
</style>
<template>
  <div class="show-accessory">
    <div v-for="e in accessory" :key="'accessory-' + e.id" class="accessory-div padding-0">
      <span v-text="e.name"></span>

      <a :href="e.url" target="_blank" title="在线预览"
         v-if="e.suffiix == '.pdf'" class="a"
      >预览</a>
      <a :href="officeappsUrl + e.url" target="_blank" title="在线预览" class="a"
         v-else-if="e.suffiix == '.doc' || e.suffiix == '.docx' || e.suffiix == '.xls' || e.suffiix == '.xlsx' || e.suffiix == '.pptx' || e.suffiix == '.ppt'"
      >预览</a>

      <a @click="DownloadFile(e.url, e.name)" title="点击下载" class="a">下载</a>
    </div>
  </div>
</template>

<script>
  import Cookies from 'js-cookie';
  import Util from '../../libs/util';
  import Utils from '../../libs/mod.utils';
  import String from '../../libs/mod.string';
  import Modal from '../../libs/mod.Modal';
  import Ckeditor from '../../libs/mod.ckeditor';
  import util from '@/libs/util.js';
  export default {
    name: 'show-accessory',
    components: {},
    props: ['accessory'],
    data () {
      return {
        officeappsUrl: Util.constant.officeappsUrl,
      };
    },
    created: function () {
      var _this = this;
    },
    mounted () {
      var _this = this;
    },
    methods: {
      // 下载附件
      DownloadFile: function (url, name) {
        var _this = this;
        if (url) {
          Utils.DownloadFile(url, name);
        }
      },
    }
  };
</script>
